*use JPP_Replication_2020_Do_03062020, opened manually*

*gen DVs
gen ResponseSum=(constituency+mission+members+leaders)/4
gen CapacitySum=(experience+resources)/2
gen NicheSum=(attention_org+noattention_org)/2
gen PosSum=(attention_opp+allies_gov+opp_gov+victory)/4
gen SalienceSum=(gov_agenda+recent_event+public_agenda+media_agenda)/4 

*transformation independent variables*

*GENERALIST
*generalist count- used in analysis*
gen generalistC = poldomains
label variable generalistC "No Policy Domains"

*member competition dummy2
gen memcom2=1 if (q34_x1==3|q34_x1==4)
replace memcom2=0 if (q34_x1==1|q34_x1==2)
tab memcom2
tab q34_x1


*MEMBER INVOLVEMENT
tab q28
tab q28, nol

gen involvementD=1 if (q28==3)
replace involvementD=0 if (q28==1|q28==2)
tab q28
tab involvementD

*gen type_4cat2*
gen type_4cat2=.
replace type_4cat2=1 if (type==2|type==5|type==3)
replace type_4cat2=2 if (type==1)
replace type_4cat2=3 if type==4
replace type_4cat2=4 if (type==6|type==7)

label define typelabel_4cat2 1 "business group" 2 "citizen group" 3 "professional group" 4 "service group" 
label values type_4cat2 typelabel_4cat2
tab type_4cat2

*log staff
gen log_staff=ln(q14+1)
label variable log_staff "Staff(ln)"

*tabel 3 summary statistics dependent variables
summarize ResponseSum CapacitySum NicheSum PosSum SalienceSum
tabstat PosSum ResponseSum SalienceSum NicheSum CapacitySum, stat(mean med sd min max)

*tabel 4 summary statistics independent variables
summ generalistC oral_dummy memcom2 involvementD type_4cat2 log_staff 
tabstat generalistC oral_dummy memcom2 involvementD type_4cat2 log_staff , stat(mean med sd min max)

*Table 5 correlation between DVs
correlate ResponseSum CapacitySum NicheSum PosSum SalienceSum
ktau ResponseSum CapacitySum NicheSum PosSum SalienceSum, stats(taub) star(0.05) matrix

*tabel 6_26052020
sureg (ResponseSum generalistC oral_dummy memcom2 involvementD log_staff i.type_4cat2) (CapacitySum generalistC oral_dummy memcom2 involvementD log_staff i.type_4cat2)(NicheSum generalistC oral_dummy memcom2 involvementD log_staff i.type_4cat2)(PosSum generalistC oral_dummy memcom2 involvementD log_staff i.type_4cat2)(SalienceSum generalistC oral_dummy memcom2 involvementD log_staff i.type_4cat2), corr   

*table A3_21052020_categorical variable competition for member funding
sureg (ResponseSum generalistC oral_dummy i.q34_x1 involvementD log_staff i.type_4cat2) (CapacitySum generalistC oral_dummy i.q34_x1 involvementD log_staff i.type_4cat2)(NicheSum generalistC oral_dummy i.q34_x1 involvementD log_staff i.type_4cat2)(PosSum generalistC oral_dummy i.q34_x1 involvementD log_staff i.type_4cat2)(SalienceSum generalistC oral_dummy i.q34_x1 involvementD log_staff i.type_4cat2), corr   

*table A4_21052020_categorical variable member involvement(i.q28)
sureg (ResponseSum generalistC oral_dummy memcom2 i.q28 log_staff i.type_4cat2) (CapacitySum generalistC oral_dummy memcom2 i.q28 log_staff i.type_4cat2)(NicheSum generalistC oral_dummy memcom2 i.q28 log_staff i.type_4cat2)(PosSum generalistC oral_dummy memcom2 i.q28 log_staff i.type_4cat2)(SalienceSum generalistC oral_dummy memcom2 i.q28 log_staff i.type_4cat2), corr   



